package lesson01;

/**
 * run()与start()辨析
 *
 * @author wileda
 * @date 2023/01/09  11:55
 */
public class Demo08 {
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            while (true) {
                System.out.println("hello thread...");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        // 调用run方法,
        thread.run();
        // 启动线程
//        thread.start();
        // 主线程中打印一句话
        while(true) {
            System.out.println("main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
